# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=greybird-themes
pkgver=3.22.10
pkgrel=1
pkgdesc="A clean minimalistic theme for Xfce, GTK+ 2 and 3"
url="https://github.com/shimmerproject/Greybird"
arch="noarch"
license="GPL-2.0-or-later AND CC-BY-SA-3.0"
subpackages="$pkgname-gtk2 $pkgname-gtk3 $pkgname-metacity $pkgname-xfwm4
	$pkgname-xfce4-notifyd:_notify $pkgname-unity"
source="greybird-$pkgver.tar.gz::https://github.com/shimmerproject/Greybird/archive/v$pkgver.tar.gz"
options="!check" # this package does not have a testsuite

builddir="$srcdir"/Greybird-$pkgver
build() {
	# Cleanup
	# Remove Unity theme
	rm -f gtk-3.0/apps/unity.css
	rm -f gtk-3.0/apps/lightdm-unity-greeter.css

	sed -i '/unity\.css/d' gtk-3.0/gtk.css
	sed -i '/lightdm-unity-greeter\.css/d' gtk-3.0/gtk.css
	sed -i '/lightdm-gtk-greeter\.css/d' gtk-3.0/gtk.css
}

package() {
	mkdir -p "$pkgdir"/usr/share/themes/Greybird
	cp -pr * "$pkgdir"/usr/share/themes/Greybird
}

_mv() {
	pkgdesc="$1"
	install_if="$pkgname=$pkgver-r$pkgrel $2";
	depends=""
	local _i
	shift; shift
	mkdir -p "$subpkgdir"/usr/share/themes/Greybird
	for _i; do
		msg "moving $_i"
		mv "$pkgdir"/usr/share/themes/Greybird/$_i  \
			"$subpkgdir"/usr/share/themes/Greybird
	done
}

gtk2() {
	_mv "Greybird GTK+2 themes" gtk+2.0 gtk-2.0
	depends="gtk-murrine-engine"
}

gtk3() { _mv "Greybird GTK+3 themes" gtk+3.0 gtk-3.0; }
metacity() { _mv "Greybird Metacity themes" metacity metacity-1; }
xfwm4() { _mv "Greybird Xfce4 themes" xfwm4 xfwm4 'xfwm4-*'; }
_notify() { _mv "Greybird Xfce4-notifyd themes" xfce4-notifyd 'xfce-notify-*'; }
unity() { _mv "Greybird Unity themes" unity 'unity'; }

sha512sums="c950de36c9733f98b454fde1ff5f8005169fab3b2782ab9f13a95a1aba938766f38666ad1229ab429fa163cf0e97cf5ecc8a84f3eb63cc378c35d79ea54b513c  greybird-3.22.10.tar.gz"
